<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
    </head>
    <body>
        <div>
            <div id="parent">Parent
                <div id="child">Child</div>
            </div>
        </div>
    </body>
</html>
<script>
    var parent=document.getElementById("parent");
    var child=document.getElementById("child");
    // parent.addEventListener("click",function(){
    //     console.log("我是你爸爸");
    // });
    // child.addEventListener("click",function(){
    //     console.log("你是我爸爸");
    // })
    // child.onclick=function(){
    //     console.log("我是你爸爸");
    // };
    // child.onclick=function(){
    //     console.log("你是我爸爸");
    // }
    child.addEventListener("click",dianji);
    function dianji(){
        console.log("篮球天王蔡徐坤");
    }
</script>